<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WiFi Logger component: include/tcp_handler.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">WiFi Logger component
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">WiFi Logger component, uses wifi to output logs</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">tcp_handler.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;sys/param.h&gt;</code><br />
<code>#include &quot;freertos/FreeRTOS.h&quot;</code><br />
<code>#include &quot;freertos/task.h&quot;</code><br />
<code>#include &quot;freertos/event_groups.h&quot;</code><br />
<code>#include &quot;esp_system.h&quot;</code><br />
<code>#include &quot;esp_wifi.h&quot;</code><br />
<code>#include &quot;esp_event.h&quot;</code><br />
<code>#include &quot;esp_log.h&quot;</code><br />
<code>#include &quot;nvs_flash.h&quot;</code><br />
<code>#include &quot;esp_netif.h&quot;</code><br />
<code>#include &quot;protocol_examples_common.h&quot;</code><br />
<code>#include &quot;lwip/err.h&quot;</code><br />
<code>#include &quot;lwip/sockets.h&quot;</code><br />
<code>#include &quot;lwip/sys.h&quot;</code><br />
<code>#include &lt;lwip/netdb.h&gt;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for tcp_handler.h:</div>
<div class="dyncontent">
<div class="center"><img src="tcp__handler_8h__incl.png" border="0" usemap="#include_2tcp__handler_8h" alt=""/></div>
</div>
</div><div class="textblock"><div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dyncontent">
<div class="center"><img src="tcp__handler_8h__dep__incl.png" border="0" usemap="#include_2tcp__handler_8hdep" alt=""/></div>
<map name="include_2tcp__handler_8hdep" id="include_2tcp__handler_8hdep">
<area shape="rect" id="node2" href="wifi__logger_8h.html" title="include/wifi_logger.h" alt="" coords="5,80,145,107"/>
<area shape="rect" id="node4" href="tcp__handler_8c.html" title="tcp_handler.c" alt="" coords="169,80,269,107"/>
<area shape="rect" id="node3" href="wifi__logger_8c.html" title="wifi_logger.c" alt="" coords="28,155,123,181"/>
</map>
</div>
</div>
<p><a href="tcp__handler_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structtcp__network__data.html">tcp_network_data</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a30e0c38ad4a5d0a16bfdd52ff64189b4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#a30e0c38ad4a5d0a16bfdd52ff64189b4">TCP_HOST_IP_ADDR</a>&#160;&#160;&#160;CONFIG_SERVER_IP_ADDRESS</td></tr>
<tr class="separator:a30e0c38ad4a5d0a16bfdd52ff64189b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a637b73f06ee87043251d022f87a8f3d4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#a637b73f06ee87043251d022f87a8f3d4">TCP_PORT</a>&#160;&#160;&#160;CONFIG_SERVER_PORT</td></tr>
<tr class="separator:a637b73f06ee87043251d022f87a8f3d4"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a6be7633691ba5c012155871a84ade82e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#a6be7633691ba5c012155871a84ade82e">tcp_network_manager</a> (struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *nm)</td></tr>
<tr class="memdesc:a6be7633691ba5c012155871a84ade82e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Manages TCP connection to the server.  <a href="#a6be7633691ba5c012155871a84ade82e">More...</a><br /></td></tr>
<tr class="separator:a6be7633691ba5c012155871a84ade82e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ca62b309e39660b29ee7605b099ee54"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#a0ca62b309e39660b29ee7605b099ee54">tcp_send_data</a> (struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *nm, char *payload)</td></tr>
<tr class="memdesc:a0ca62b309e39660b29ee7605b099ee54"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends data to the server through a TCP socket.  <a href="#a0ca62b309e39660b29ee7605b099ee54">More...</a><br /></td></tr>
<tr class="separator:a0ca62b309e39660b29ee7605b099ee54"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae6ccc1779864871030d25e2b8c7d56f4"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#ae6ccc1779864871030d25e2b8c7d56f4">tcp_receive_data</a> (struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *nm)</td></tr>
<tr class="memdesc:ae6ccc1779864871030d25e2b8c7d56f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receives data from TCP server.  <a href="#ae6ccc1779864871030d25e2b8c7d56f4">More...</a><br /></td></tr>
<tr class="separator:ae6ccc1779864871030d25e2b8c7d56f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d6a248c21ebfece9f52fa7b580fabb5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="tcp__handler_8h.html#a6d6a248c21ebfece9f52fa7b580fabb5">tcp_close_network_manager</a> (struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *nm)</td></tr>
<tr class="memdesc:a6d6a248c21ebfece9f52fa7b580fabb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Shutdown active connection, deallocate memory.  <a href="#a6d6a248c21ebfece9f52fa7b580fabb5">More...</a><br /></td></tr>
<tr class="separator:a6d6a248c21ebfece9f52fa7b580fabb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a30e0c38ad4a5d0a16bfdd52ff64189b4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a30e0c38ad4a5d0a16bfdd52ff64189b4">&#9670;&nbsp;</a></span>TCP_HOST_IP_ADDR</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TCP_HOST_IP_ADDR&#160;&#160;&#160;CONFIG_SERVER_IP_ADDRESS</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a637b73f06ee87043251d022f87a8f3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a637b73f06ee87043251d022f87a8f3d4">&#9670;&nbsp;</a></span>TCP_PORT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define TCP_PORT&#160;&#160;&#160;CONFIG_SERVER_PORT</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a6d6a248c21ebfece9f52fa7b580fabb5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d6a248c21ebfece9f52fa7b580fabb5">&#9670;&nbsp;</a></span>tcp_close_network_manager()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tcp_close_network_manager </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *&#160;</td>
          <td class="paramname"><em>nm</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Shutdown active connection, deallocate memory. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nm</td><td><a class="el" href="structtcp__network__data.html">tcp_network_data</a> struct which contains connection info </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>

</div>
</div>
<a id="a6be7633691ba5c012155871a84ade82e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6be7633691ba5c012155871a84ade82e">&#9670;&nbsp;</a></span>tcp_network_manager()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void tcp_network_manager </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *&#160;</td>
          <td class="paramname"><em>nm</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Manages TCP connection to the server. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nm</td><td><a class="el" href="structtcp__network__data.html">tcp_network_data</a> struct which contains necessary data for a TCP connection </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>

</div>
</div>
<a id="ae6ccc1779864871030d25e2b8c7d56f4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae6ccc1779864871030d25e2b8c7d56f4">&#9670;&nbsp;</a></span>tcp_receive_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">char* tcp_receive_data </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *&#160;</td>
          <td class="paramname"><em>nm</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receives data from TCP server. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nm</td><td><a class="el" href="structtcp__network__data.html">tcp_network_data</a> struct which contains connection info </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>char array which contains data received </dd></dl>

</div>
</div>
<a id="a0ca62b309e39660b29ee7605b099ee54"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ca62b309e39660b29ee7605b099ee54">&#9670;&nbsp;</a></span>tcp_send_data()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int tcp_send_data </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structtcp__network__data.html">tcp_network_data</a> *&#160;</td>
          <td class="paramname"><em>nm</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>payload</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sends data to the server through a TCP socket. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nm</td><td>A pointer to <a class="el" href="structtcp__network__data.html">tcp_network_data</a> struct </td></tr>
    <tr><td class="paramname">payload</td><td>char array which contains data to be sent </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>int - returns -1 if sending failed, number of bytes sent if successfully sent the data </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
